package com.example.demo.jbdc;

import org.junit.jupiter.api.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

class JdbcTest {

    @Test
    void test() throws ClassNotFoundException, SQLException{
        String URL="jdbc:mysql://192.168.80.64:3306/soft_test?characterEncoding=utf-8";
        String USER="root";
        String PASSWORD="123456";

        Class.forName("com.mysql.jdbc.Driver");
        Connection conn= DriverManager.getConnection(URL,USER,PASSWORD);
        System.out.println(conn.isClosed());

        String sql="Insert into t_student(name,idno,age)values('zs','352121212121212',18)";
        Statement statement=conn.createStatement();
        boolean execute=statement.execute(sql);
        System.out.println(execute);
    }
}
